package com.youlu.campus.admin.english;

import com.youlu.campus.common.base.RestResult;
import com.youlu.campus.common.base.RestResultBuilder;
import com.youlu.campus.entity.english.UserCompetition;
import com.youlu.campus.entity.english.vo.request.UserCompetitionFeeQuery;
import com.youlu.campus.service.english.UserCompetitionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class UserCompetitionController {

    @Autowired
    private UserCompetitionService userCompetitionService;

    @PostMapping("/competition/register/list")
    public RestResult list(@RequestBody UserCompetitionFeeQuery userCompetitionFeeQuery){
        return RestResultBuilder.builder().success().data(userCompetitionService.list(userCompetitionFeeQuery)).build();
    }

    @GetMapping("/competition/user-info/detail")
    public RestResult detail(@RequestParam String id){
        return RestResultBuilder.builder().success().data(userCompetitionService.detail(id)).build();
    }

    @PostMapping("/competition/user-info/update")
    public RestResult update(@RequestBody UserCompetition userCompetition){
        userCompetitionService.updateUserInfo(userCompetition);
        return RestResultBuilder.builder().success().build();
    }
}
